<?php
ob_start();
require_once '../sub/init.php';
define('ZEAI2',dirname(__FILE__).DIRECTORY_SEPARATOR);
require_once 'chkUadm.php';
if(!in_array('analyse_u',$QXARR))exit(noauth());
require_once ZEAI.'cache/udata.php';

$SQL=" kind<>4 ";
switch ($submitok) {
	case 'ajax_sex':
		$num1 = $db->COUNT(__TBL_USER__,"sex=1 AND kind<>4");
		$num2 = $db->COUNT(__TBL_USER__,"sex=2 AND kind<>4");
		$all = $num1+$num2;
		$user1=round($num1/$all,2)*100;
		$user2=round($num2/$all,2)*100;
		if($user1==0 || $user2==0){
			json_exit(array('flag'=>0));
		}else{
			json_exit(array('flag'=>1,'user1'=>$user1,'user2'=>$user2,'num1'=>$num1,'num2'=>$num2));
		}
	break;
	case 'ajax_grade':
		$urole = json_decode($_ZEAI['urole']);
		$total = $db->COUNT(__TBL_USER__,"kind<>4");
		$arr=array();
		foreach ($urole as $uv) {
			$grade = $uv->g;
			$title = $uv->t;
			if($grade==1)continue;
			$num = $db->COUNT(__TBL_USER__,"kind<>4 AND grade=".$grade);
			$bfb=round($num/$total,4)*100;
			$arr[]=array('name'=>$title.'：'.$num.'人','y'=>$bfb);
		}
		if(!empty($arr)){
			exit(encode_json($arr));
		}else{
			exit;	
		}
	break;
	case 'ajax_data':
		$num1 = $db->COUNT(__TBL_USER__,"myinfobfb<=9 AND kind<>4");
		$num2 = $db->COUNT(__TBL_USER__,"myinfobfb>=10 AND myinfobfb<=59 AND kind<>4");
		$num3 = $db->COUNT(__TBL_USER__,"myinfobfb>=60 AND myinfobfb<=89 AND  kind<>4");
		$num4 = $db->COUNT(__TBL_USER__,"myinfobfb>=90 AND kind<>4");
		$all = $num1+$num2+$num3+$num4;
		$bfb1=round($num1/$all,2)*100;
		$bfb2=round($num2/$all,2)*100;
		$bfb3=round($num3/$all,2)*100;
		$bfb4=round($num4/$all,2)*100;
		if($bfb1==0 && $bfb2==0 && $bfb3==0 && $bfb4==0){
			json_exit(array('flag'=>0));
		}else{
			json_exit(array('flag'=>1,'b1'=>$bfb1,'b2'=>$bfb2,'b3'=>$bfb3,'b4'=>$bfb4,'n1'=>$num1,'n2'=>$num2,'n3'=>$num3,'n4'=>$num4));
		}
	break;
	case 'ajax_reg_month':
		$rt=$db->query("SELECT COUNT(id) AS num,from_unixtime(regtime,'%Y-%m') AS month FROM ".__TBL_USER__." WHERE kind<>4 GROUP BY month ORDER BY month DESC LIMIT 10");
		$total = $db->num_rows($rt);
		if ($total <= 0) {
			exit('');
		} else {
			while($tmprows = $db->fetch_array($rt,'name')){$arr[]=$tmprows;}
			$arrnew = array_reverse($arr);
			foreach ($arrnew as $rows) {
				$day = $rows['month'];
				$num = $rows['num'];
				$arr[]=array("'".$day."'".",".$num);
			}
			exit(encode_json($arr));
		}
	break;
	case 'ajax_cert':
		$rz_dataARR = explode(',',$_ZEAI['rz_data']);
		$total = count($rz_dataARR);
		$_UDATA_sex  = json_decode($_UDATA['sex'],true);
		if ($total >= 1 && is_array($rz_dataARR)){
			foreach ($rz_dataARR as $V) {
				$categories[] = rz_data_info($V,'title');
			}	
			$data = array();
			foreach ($rz_dataARR as $V2) {
				$num = $db->COUNT(__TBL_USER__,"sex=1 AND kind<>4 AND FIND_IN_SET('".$V2."',RZ) ");
				$data[] = intval($num);
			}
			$series[] = array('name'=>'男','data'=>$data,'dataLabels'=>array('enabled'=>0,'allowOverlap'=>1,'style'=>array('fontWeight'=>'normal')));
			$data = array();
			foreach ($rz_dataARR as $V2) {
				$num = $db->COUNT(__TBL_USER__,"sex=2 AND kind<>4 AND FIND_IN_SET('".$V2."',RZ) ");
				$data[] = intval($num);
			}
			$series[] = array('name'=>'女','data'=>$data,'dataLabels'=>array('enabled'=>0,'allowOverlap'=>1,'style'=>array('fontWeight'=>'normal')));
		}
		json_exit(array('categories'=>$categories,'series'=>$series));
	break;
	case 'ajax_flag':
		$_UDATA['flag']='[{"i":"-2","v":"隐藏"},{"i":"-1","v":"锁定(已注销)"},{"i":"0","v":"未审"},{"i":"1","v":"正常"},{"i":"2","v":"注册未完成"}]';	
		$_UDATA_flag = json_decode($_UDATA['flag'],true);
		if (count($_UDATA_flag) >= 1 && is_array($_UDATA_flag)){
			foreach ($_UDATA_flag as $V) {
				$id    = intval($V['i']);
				$title = $V['v'];
				$num   = $db->COUNT(__TBL_USER__,"kind<>4 AND flag =".$id);
				$categories[]=$title;
				$arr[]=array("'".$title."'".",".$num);
			}
			exit(encode_json($arr));
		}else{
			echo '';exit;	
		}
	break;
	//年龄
	case 'ajax_age':
		//20岁以下
		$num = $db->COUNT(__TBL_USER__,$SQL.$SQL_AGENT." AND sex=1 AND (  (YEAR(CURDATE())-YEAR(birthday)-(RIGHT(CURDATE(),5)<RIGHT(birthday,5))) <=19 )  ");
		$data[] = intval($num);
		//20~29岁
		$num = $db->COUNT(__TBL_USER__,$SQL.$SQL_AGENT." AND sex=1 AND ( (YEAR(CURDATE())-YEAR(birthday)-(RIGHT(CURDATE(),5)<RIGHT(birthday,5))) >= 20 ) AND ( (YEAR(CURDATE())-YEAR(birthday)-(RIGHT(CURDATE(),5)<RIGHT(birthday,5))) <=29 )  ");
		$data[] = intval($num);
		//30~39岁
		$num = $db->COUNT(__TBL_USER__,$SQL.$SQL_AGENT." AND sex=1 AND ( (YEAR(CURDATE())-YEAR(birthday)-(RIGHT(CURDATE(),5)<RIGHT(birthday,5))) >= 30 ) AND ( (YEAR(CURDATE())-YEAR(birthday)-(RIGHT(CURDATE(),5)<RIGHT(birthday,5))) <=39 )  ");
		$data[] = intval($num);
		//40~49岁
		$num = $db->COUNT(__TBL_USER__,$SQL.$SQL_AGENT." AND sex=1 AND ( (YEAR(CURDATE())-YEAR(birthday)-(RIGHT(CURDATE(),5)<RIGHT(birthday,5))) >= 40 ) AND ( (YEAR(CURDATE())-YEAR(birthday)-(RIGHT(CURDATE(),5)<RIGHT(birthday,5))) <=49 )  ");
		$data[] = intval($num);
		//50岁及以上
		$num = $db->COUNT(__TBL_USER__,$SQL.$SQL_AGENT." AND sex=1 AND ( (YEAR(CURDATE())-YEAR(birthday)-(RIGHT(CURDATE(),5)<RIGHT(birthday,5))) >= 50 )  ");
		$data[] = intval($num);
		$series[] = array('name'=>'男','data'=>$data,'dataLabels'=>array('enabled'=>0,'allowOverlap'=>1,'style'=>array('fontWeight'=>'normal')));
		
		$data = array();
		//20岁以下
		$num = $db->COUNT(__TBL_USER__,$SQL.$SQL_AGENT." AND sex=2 AND (  (YEAR(CURDATE())-YEAR(birthday)-(RIGHT(CURDATE(),5)<RIGHT(birthday,5))) <=19 )  ");
		$data[] = intval($num);
		//20~29岁
		$num = $db->COUNT(__TBL_USER__,$SQL.$SQL_AGENT." AND sex=2 AND ( (YEAR(CURDATE())-YEAR(birthday)-(RIGHT(CURDATE(),5)<RIGHT(birthday,5))) >= 20 ) AND ( (YEAR(CURDATE())-YEAR(birthday)-(RIGHT(CURDATE(),5)<RIGHT(birthday,5))) <=29 )  ");
		$data[] = intval($num);
		//30~39岁
		$num = $db->COUNT(__TBL_USER__,$SQL.$SQL_AGENT." AND sex=2 AND ( (YEAR(CURDATE())-YEAR(birthday)-(RIGHT(CURDATE(),5)<RIGHT(birthday,5))) >= 30 ) AND ( (YEAR(CURDATE())-YEAR(birthday)-(RIGHT(CURDATE(),5)<RIGHT(birthday,5))) <=39 )  ");
		$data[] = intval($num);
		//40~49岁
		$num = $db->COUNT(__TBL_USER__,$SQL.$SQL_AGENT." AND sex=2 AND ( (YEAR(CURDATE())-YEAR(birthday)-(RIGHT(CURDATE(),5)<RIGHT(birthday,5))) >= 40 ) AND ( (YEAR(CURDATE())-YEAR(birthday)-(RIGHT(CURDATE(),5)<RIGHT(birthday,5))) <=49 )  ");
		$data[] = intval($num);
		//50岁及以上
		$num = $db->COUNT(__TBL_USER__,$SQL.$SQL_AGENT." AND sex=2 AND ( (YEAR(CURDATE())-YEAR(birthday)-(RIGHT(CURDATE(),5)<RIGHT(birthday,5))) >= 50 )  ");
		$data[] = intval($num);
		$series[] = array('name'=>'女','data'=>$data,'dataLabels'=>array('enabled'=>0,'allowOverlap'=>1,'style'=>array('fontWeight'=>'normal')));

		$categories = array('19岁及以下','20~29岁','30~39岁','40~49岁','50岁及以上');
		json_exit(array('categories'=>$categories,'series'=>$series));
	break;
	//用户婚姻状态分析
	case 'ajax_love':
		$_UDATA_love = json_decode($_UDATA['love'],true);
		$_UDATA_sex  = json_decode($_UDATA['sex'],true);
		if (count($_UDATA_love) >= 1 && is_array($_UDATA_love)){
			foreach ($_UDATA_love as $V) {
				$love     = intval($V['i']);
				$love_str = $V['v'];
				$categories[] = $love_str;
			}	
			$data = array();
			foreach ($_UDATA_love as $V2) {
				$love     = $V2['i'];
				$love_str = $V2['v'];
				$num = $db->COUNT(__TBL_USER__,$SQL.$SQL_AGENT." AND sex=1 AND love=".$love);
				$data[] = intval($num);
			}
			$series[] = array('name'=>'男','data'=>$data,'dataLabels'=>array('enabled'=>0,'allowOverlap'=>1,'style'=>array('fontWeight'=>'normal')));
			$data = array();
			foreach ($_UDATA_love as $V2) {
				$love     = $V2['i'];
				$love_str = $V2['v'];
				$num = $db->COUNT(__TBL_USER__,$SQL.$SQL_AGENT." AND sex=2 AND love=".$love);
				$data[] = intval($num);
			}
			$series[] = array('name'=>'女','data'=>$data,'dataLabels'=>array('enabled'=>0,'allowOverlap'=>1,'style'=>array('fontWeight'=>'normal')));
		}
		json_exit(array('categories'=>$categories,'series'=>$series));
	break;
	//用户学历分析
	case 'ajax_edu':
		$all = intval($db->COUNT(__TBL_USER__,$SQL.$SQL_AGENT." AND edu>0 "));
		$_UDATA_edu = json_decode($_UDATA['edu'],true);
		if (count($_UDATA_edu) >= 1 && is_array($_UDATA_edu)){
			foreach ($_UDATA_edu as $V) {
				$eduid    = intval($V['i']);
				$edutitle = $V['v'];
				$num      = $db->COUNT(__TBL_USER__,$SQL.$SQL_AGENT." AND edu=".$eduid);
				if($all>0){
					$bfb=round($num/$all,5)*100;
				}else{
					$bfb=0;
				}
				$data[] = array('name'=>$edutitle.'：'.$num.'人','y'=>$bfb);
			}
		}
		json_exit(array('data'=>$data));
	break;
	//用户学历分析VIP
	case 'ajax_edu_vip':
		$all = intval($db->COUNT(__TBL_USER__,$SQL.$SQL_AGENT." AND edu>0 AND grade>1 "));
		$_UDATA_edu = json_decode($_UDATA['edu'],true);
		if (count($_UDATA_edu) >= 1 && is_array($_UDATA_edu)){
			foreach ($_UDATA_edu as $V) {
				$eduid    = intval($V['i']);
				$edutitle = $V['v'];
				$num      = $db->COUNT(__TBL_USER__,$SQL.$SQL_AGENT." AND edu=".$eduid." AND grade>1 ");
				if($all>0){
					$bfb=round($num/$all,5)*100;
				}else{
					$bfb=0;
				}
				$data[] = array('name'=>$edutitle.'：'.$num.'人','y'=>$bfb);
			}
		}
		json_exit(array('data'=>$data));
	break;
	//收入
	case 'ajax_pay':
		$all = intval($db->COUNT(__TBL_USER__,$SQL.$SQL_AGENT." AND pay>0 "));
		$_UDATA_pay = json_decode($_UDATA['pay'],true);
		if (count($_UDATA_pay) >= 1 && is_array($_UDATA_pay)){
			foreach ($_UDATA_pay as $V) {
				$eduid    = intval($V['i']);
				$edutitle = $V['v'];
				$num      = $db->COUNT(__TBL_USER__,$SQL.$SQL_AGENT." AND pay=".$eduid);
				if($all>0){
					$bfb=round($num/$all,5)*100;
				}else{
					$bfb=0;
				}
				$data[] = array('name'=>$edutitle.'：'.$num.'人','y'=>$bfb);
			}
		}
		json_exit(array('data'=>$data));
	break;
	//房产
	case 'ajax_house':
		$_UDATA_house = json_decode($_UDATA['house'],true);
		if (count($_UDATA_house) >= 1 && is_array($_UDATA_house)){
			foreach ($_UDATA_house as $V) {
				$houseid    = intval($V['i']);
				$housetitle = $V['v'];
				$num = $db->COUNT(__TBL_USER__,$SQL.$SQL_AGENT." AND house =".$houseid);
				$categories[]=$housetitle;
				$arr[]=array("'".$housetitle."'".",".$num);
			}
			exit(encode_json($arr));
		}else{
			echo '';exit;	
		}
	break;
	//车
	case 'ajax_car':
		$all = intval($db->COUNT(__TBL_USER__,$SQL.$SQL_AGENT." AND car>0 "));
		$_UDATA_car = json_decode($_UDATA['car'],true);
		if (count($_UDATA_car) >= 1 && is_array($_UDATA_car)){
			foreach ($_UDATA_car as $V) {
				$carid    = intval($V['i']);
				$cartitle = $V['v'];
				$num      = $db->COUNT(__TBL_USER__,$SQL.$SQL_AGENT." AND car=".$carid);
				if($all>0){
					$bfb=round($num/$all,4)*100;
				}else{
					$bfb=0;
				}
				$data[] = array('name'=>$cartitle.'：'.$num.'人','y'=>$bfb);
			}
		}
		json_exit(array('data'=>$data));
	break;
}?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="<?php echo HOST;?>/res/www_zeai_cn.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="js/highcharts/highcharts.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="js/highcharts/exporting.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="js/highcharts/highcharts-zh_CN.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script>var agentid,jsfilename='analyse_u';</script>
<link href="css/main.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css">
<style>
.cbox{width:97%;margin:0 auto 20px auto;text-align:left;box-sizing:border-box;padding-bottom:15px;clear:both;overflow:auto;position:relative;border:#eee 1px solid}
.cbox h5{width:100%;background-color:#fafafa;font-size:14px;font-weight:normal;line-height:50px;margin:0 0 10px 0;padding:0 15px;display:block;position:relative;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;border-radius:4px}
.cbox span.line,.cbox span.right_line{width:48px;border-bottom:#009688 2px solid;position:absolute;top:50px;left:18px}
.cbox span.right{position:absolute;top:0px;left:50%}
.cbox span.right_line{left:-webkit-calc(50% + 35px)}
.cbox ul{font-size:32px;padding:30px 0;width:40%;margin:10px 5%;border:#E1E6EB 1px solid;text-align:center;float:left;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box}
.cbox ul em{height:40px;line-height:40px}
.cbox ul em i{color:#009688}
.cbox ul div{font-size:14px;color:#999;margin-top:5px}
.cbox ul:nth-child(2) em{color:#EE5A4E}
.cbox ul:nth-child(2) em i{color:#EE5A4E}
.box{min-width:1200px}
</style>
</head>
<body>
<div class="box">
	<div class="boxL">
        <a href="analyse_u.php?t=1" <?php echo ($t == 1)?' class="ed"':'';?>>用户分析</a>
        <a href="analyse_u.php?t=2" <?php echo ($t == 2)?' class="ed"':'';?>>资料分析</a>
	</div>
	<div class="boxR">
        <?php if ($t == 1){?>
        <table width="100%" border="0">
          <tr>
            <td width="50%">
            <div class="cbox">
                <h5>男女占比<span class="line"></span></h5>
                <div id="sex_box" style="height:240px"></div>
            </div>
            <script>
			function sexFn(u1,u2,num1,num2){
				Highcharts.chart('sex_box', {
					chart: {
						plotBackgroundColor: null,
						plotBorderWidth: null,
						plotShadow: false,
						type: 'pie'
					},
					title: {text: ''},
					tooltip: {pointFormat: '<font style="font-weight:normal;color:#666">{series.name}<br>{point.percentage:.0f}%</font>'},
					credits: {"enabled": false},
					plotOptions: {
						pie: {
							allowPointSelect: true,
							cursor: 'pointer',
							dataLabels: {
								enabled: true,
								format: '<b style="font-weight:normal;color:#666;font-size:14px">{point.name}</b><br><b style="font-weight:normal;color:#666;font-size:14px">占比：{point.percentage:.0f} %</b>',
								style: {
									color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
								}
							}
						}
					},
					colors: ["#7CC7C0","#FEA2C8","#ffab4a","#90C9FB"],
					series: [{
						name: '',
						colorByPoint: true,
						data: [{
							name: '男生：'+num1+'人',
							y:u1
							//sliced: true,
							//selected: true
						}, {
							name: '女生：'+num2+'人',
							y:u2,
							sliced: true//selected: true
						}]
					}]
				});
			}
			setTimeout(function(){
				zeai.ajax({url:'analyse_u'+zeai.ajxext+'submitok=ajax_sex'},function(e){rs=zeai.jsoneval(e);
					if(rs.flag==1){
						var u1=parseInt(rs.user1),u2=parseInt(rs.user2),num1=parseInt(rs.num1),num2=parseInt(rs.num2);
						sexFn(u1,u2,num1,num2);
					}
				});
			},100);
            </script>
            </td>
            <td width="50%">
            <div class="cbox">
                <h5>VIP会员占比<span class="line"></span></h5>
                <div id="grade_box" style="height:240px"></div>
            </div>
			<script>
			function grade_Fn(arr){
				Highcharts.chart('grade_box', {
					chart: {
						plotBackgroundColor: null,
						plotBorderWidth: null,
						plotShadow: false,
						type: 'pie'
					},
					title: {text: ''},
					tooltip: {pointFormat: '<font style="font-weight:normal;color:#666;font-size:14px">{series.name}<br>{point.percentage:.2f}%</font>'},
					credits: {"enabled": false},
					plotOptions: {
						pie: {
							allowPointSelect: true,
							cursor: 'pointer',
							dataLabels: {
								enabled: true,
								format: '<b style="font-weight:normal;color:#666;font-size:14px">{point.name}</b><br><b style="font-weight:normal;color:#666;font-size:14px">占比：{point.percentage:.2f} %</b>',
								style: {
									color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
								}
							}
						}
					},
					colors: ["#7CC7C0","#FEA2C8","#ffab4a","#90C9FB","#ffab4a","#90C9FB","#ff6600","#0099cc","#ff9900","#0000ff","#0000cc"],
					series: [{
						name: '',
						colorByPoint:true,
						data:arr
					}]
				});
			}
			setTimeout(function(){
				zeai.ajax({url:'analyse_u'+zeai.ajxext+'submitok=ajax_grade'},function(e){
					if(!zeai.empty(e)){
						var arr=zeai.jsoneval(e);
						var parent=[],son=[];
						for(var j=0;j<arr.length;j++){
							var son=[];
							for( key in arr[j]){
								if(key=='y'){
									var str=parseFloat(arr[j][key]);
								}else{
									var str=arr[j][key];
								}
								son.push(str);
							}
							parent.push(son);
						}
						grade_Fn(parent);
					}
				});
			},600);
            </script>
            </td>
          </tr>
        </table>


        <table width="100%" border="0">
          <tr>
            <td width="50%">
            <div class="cbox">
                <h5>资料完善度占比<span class="line"></span></h5>
                <div id="databfb_box" style="height:240px"></div>
            </div>
            <script>
			function databfbFn(b1,b2,b3,b4,n1,n2,n3,n4){
				Highcharts.chart('databfb_box', {
					chart: {
						plotBackgroundColor: null,
						plotBorderWidth: null,
						plotShadow: false,
						type: 'pie'
					},
					title: {text: ''},
					tooltip: {pointFormat: '<font style="font-weight:normal;color:#666;font-size:14px">{series.name}<br>{point.percentage:.0f}%</font>'},
					credits: {"enabled": false},
					plotOptions: {
						pie: {
							allowPointSelect: true,
							cursor: 'pointer',
							dataLabels: {
								enabled: true,
								format: '<b style="font-weight:normal;color:#666;font-size:14px">{point.name}</b><br><b style="font-weight:normal;color:#666;font-size:14px">占比：{point.percentage:.0f} %</b>',
								style: {
									color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
								}
							}
						}
					},
					colors: ["#7CC7C0","#FEA2C8","#ffab4a","#90C9FB"],
					series: [{
						name: '',
						colorByPoint:true,
						data: [{name:'≤9％：'+n1+'人',y:b1
							//sliced: true,
							//selected: true
						},
						{name:'10-59％：'+n2+'人',y:b2/*,sliced:trueselected: true*/},
						{name:'60-89％：'+n3+'人',y:b3/*,sliced:trueselected: true*/},
						{name:'≥90％：'+n4+'人',y:b4,sliced:true/*selected: true*/}
						
						]
					}]
				});
			}
			setTimeout(function(){
				zeai.ajax({url:'analyse_u'+zeai.ajxext+'submitok=ajax_data'},function(e){rs=zeai.jsoneval(e);
					if(rs.flag==1){
						var b1=parseInt(rs.b1),b2=parseInt(rs.b2),b3=parseInt(rs.b3),b4=parseInt(rs.b4),n1=parseInt(rs.n1),n2=parseInt(rs.n2),n3=parseInt(rs.n3),n4=parseInt(rs.n4);
						databfbFn(b1,b2,b3,b4,n1,n2,n3,n4);
					}
				});
			},1100);
            </script>
            </td>
            <td width="50%">
            <div class="cbox">
                <h5>用户月注册量<span class="line"></span></h5>
                <div id="reg_month_box" style="height:240px"></div>
            </div>
			<script>
            function reg_monthFn(arr){
                Highcharts.chart('reg_month_box', {
                    chart: {type: 'column'},
                    title: {text: '　'},
                    subtitle: {text: ''},
                    credits: {"enabled": false},
                    xAxis: {
                        type: 'category',
                        labels: {
                            rotation: -45,
                            style: {fontSize: '12px',fontFamily: 'Verdana, sans-serif'}
                        }
                    },
                    yAxis: {min: 0,title: {text:'最近10个月用户注册量'}},
                    legend: {enabled: false},
                    tooltip: {pointFormat: '<b style="font-weight:normal;color:#666">注册{point.y:.0f}人</b>'},
                    colors: ["#7CC7C0"],
                    series: [{
                        name: 'zea.cn',
                        data: arr,
                        dataLabels: {
                            enabled: true,
                            rotation:0,
                            color: '#ffffff',
                            align: 'center',
                            format: '{point.y:.0f}', // one decimal
                            y:22, //10 pixels down from the top
                            style:{fontSize:'12px',fontFamily:'Arial,sans-serif'}
                        }
                    }]
                });
            }
			setTimeout(function(){
				zeai.ajax({url:'analyse_u'+zeai.ajxext+'submitok=ajax_reg_month'},function(e){
					if(!zeai.empty(e)){
						var arr=e;
						arr = arr.replace(/"/g,"");
						arr = zeai.jsoneval(arr);
						reg_monthFn(arr);
					}
				});
			},1600);
            </script>
            </td>
          </tr>
        </table>
        
        
        <table width="100%" border="0">
          <tr>
            <td width="50%">
            <div class="cbox">
                <h5>诚信认证分析<span class="line"></span></h5>
                <div id="cert_box" style="height:240px"></div>
            </div>
			<script>
			function certFn(categories,series){
				var chart = Highcharts.chart('cert_box',{
					chart: {type: 'column'},
					title: {text: ''},
					credits: {"enabled": false},
					subtitle: {text: ''},
					xAxis: {categories:categories,crosshair:true},
					yAxis: {min: 0,title: {text: '诚信认证占比分析'}},
					tooltip: {
						// head + 每个 point + footer 拼接成完整的 table
						headerFormat: '<span style="font-size:18px;font-weight:bold">{point.key}</span><table>',
						pointFormat: '<tr><td style="font-size:14px;color:{series.color};padding:2px">{series.name}: </td>' +
						'<td style="padding:0"><b>{point.y:f} 人</b></td></tr>',
						footerFormat: '</table>',
						shared: true,
						useHTML: true
					},
					plotOptions: {column: {borderWidth:1,}},
					colors: ["#95CEFF","#FEA2C8","#ffab4a","#90C9FB"],
					series:series,
					legend: {verticalAlign:"top"}
				});
			}
			setTimeout(function(){
				zeai.ajax({url:'analyse_u'+zeai.ajxext+'submitok=ajax_cert'},function(e){//,data:{sDATE1:sDATE1,agentid:agentid}
					if(!zeai.empty(e)){
						var rs=zeai.jsoneval(e);
						var series = rs.series;
						for(var k=0;k<series.length;k++) {
							series[k].data = eval('['+series[k].data+']');
						}
						certFn(rs.categories,series);
					}
				});
			},2100);
            </script>
            </td>
            <td width="50%">
            <div class="cbox">
                <h5>用户帐号状态分析<span class="line"></span></h5>
                <div id="flag_box" style="height:240px"></div>
            </div>
            <script>
			function flagFn(data){
				Highcharts.chart('flag_box', {
					chart: {type: 'column'},
					title: {text: '　'},
					subtitle: {text: ''},
					credits: {"enabled": false},
					xAxis: {
						type: 'category',
						labels: {
							rotation: 0,
							style: {fontSize: '12px',fontFamily: 'Verdana, sans-serif'}
						}
					},
					yAxis: {min: 0,title: {text:'住房占比人数'}},
					legend: {enabled: false},
					tooltip: {pointFormat: '<b style="font-weight:normal;color:#666">{point.y:.0f}人</b>'},
					colors: ["#95CEFF"],
					series: [{
						name: 'zea.cn',
						data: data,
						dataLabels: {
							enabled: true,
							rotation:0,
							align: 'center',
							format: '{point.y:.0f}人', // one decimal
							y:0, //10 pixels down from the top
							style:{fontSize:'12px',fontWeight:'normal',fontFamily:'Arial,sans-serif'}
						}
					}]
				});
			}
			setTimeout(function(){
				zeai.ajax({url:'analyse_u'+zeai.ajxext+'submitok=ajax_flag'},function(e){//,data:{sDATE1:sDATE1,agentid:agentid}
					if(!zeai.empty(e)){
						var arr=e;
						arr = arr.replace(/"/g,"");
						arr = zeai.jsoneval(arr);
						flagFn(arr);
					}
				});
			},2600);
            </script>
            </td>
          </tr>
        </table>
        <!--t=2-->
        <?php }elseif($t==2){ ?>
        

        <table width="100%" border="0">
            <tr>
            <td width="50%">
            <div class="cbox">
                <h5>用户年龄男女分析<span class="line"></span></h5>
                <div id="age_box" style="height:240px"></div>
            </div>
            <script>
                function ageFn(categories,series){
                    var chart = Highcharts.chart('age_box',{
                        chart: {type: 'column'},
                        title: {text: ''},
                        credits: {"enabled": false},
                        subtitle: {text: ''},
                        xAxis: {categories:categories,crosshair:true},
                        yAxis: {min: 0,title: {text: '年龄段人数占比'}},
                        tooltip: {
                            // head + 每个 point + footer 拼接成完整的 table
                            headerFormat: '<span style="font-size:18px;font-weight:bold">{point.key}</span><table>',
                            pointFormat: '<tr><td style="font-size:14px;color:{series.color};padding:2px">{series.name}: </td>' +
                            '<td style="padding:0"><b>{point.y:f} 人</b></td></tr>',
                            footerFormat: '</table>',
                            shared: true,
                            useHTML: true
                        },
                        plotOptions: {column: {borderWidth:1,}},
                        colors: ["#95CEFF","#FEA2C8"],
                        series:series,
                        legend: {verticalAlign:"top"}
                    });
                }
                setTimeout(function(){
                    zeai.ajax({url:'analyse_u'+zeai.ajxext+'submitok=ajax_age',data:{agentid:agentid}},function(e){
                        if(!zeai.empty(e)){
                            var rs=zeai.jsoneval(e);
                            var series = rs.series;
                            for(var k=0;k<series.length;k++) {
                                series[k].data = eval('['+series[k].data+']');
                            }
                            ageFn(rs.categories,series);
                        }
                    });
                },100);
            </script>
            </td>
            <td width="50%">
            <div class="cbox">
                <h5>用户婚姻状况分析<span class="line"></span></h5>
                <div id="love_box" style="height:240px"></div>
            </div>
			<script>
            function loveFn(categories,series){
                var chart = Highcharts.chart('love_box',{
                    chart: {type: 'column'},
                    title: {text: ''},
                    credits: {"enabled": false},
                    subtitle: {text: ''},
                    xAxis: {categories:categories,crosshair:true},
                    yAxis: {min: 0,title: {text: '婚姻状况人数占比'}},
                    tooltip: {
                        // head + 每个 point + footer 拼接成完整的 table
                        headerFormat: '<span style="font-size:18px;font-weight:bold">{point.key}</span><table>',
                        pointFormat: '<tr><td style="font-size:14px;color:{series.color};padding:2px">{series.name}: </td>' +
                        '<td style="padding:0"><b>{point.y:f} 人</b></td></tr>',
                        footerFormat: '</table>',
                        shared: true,
                        useHTML: true
                    },
                    plotOptions: {column: {borderWidth:1,}},
                    colors: ["#95CEFF","#FEA2C8","#ffab4a","#90C9FB"],
                    series:series,
                    legend: {verticalAlign:"top"}
                });
            }
            setTimeout(function(){
                zeai.ajax({url:jsfilename+zeai.ajxext+'submitok=ajax_love',data:{agentid:agentid}},function(e){
                    if(!zeai.empty(e)){
                        var rs=zeai.jsoneval(e);
                        var series = rs.series;
                        for(var k=0;k<series.length;k++) {
                            series[k].data = eval('['+series[k].data+']');
                        }
                        loveFn(rs.categories,series);
                    }
                });
            },600);
            </script>
            </td>
            </tr>
        </table>        
        <table width="100%" border="0">
            <tr>
            <td width="50%">
            <div class="cbox">
                <h5>用户学历分析<span class="line"></span></h5>
                <div id="edu_box" style="height:280px"></div>
            </div>
            <script>
			function eduFn(data){
				Highcharts.chart('edu_box', {
					chart: {
						plotBackgroundColor: null,
						plotBorderWidth: null,
						plotShadow: false,
						type: 'pie'
					},
					title: {text: ''},
					tooltip: {pointFormat: '<font style="font-weight:normal;color:#666">{series.name}<br>{point.percentage:.2f}%</font>'},
					credits: {"enabled": false},
					plotOptions: {
						pie: {
							allowPointSelect: true,
							cursor: 'pointer',
							dataLabels: {
								enabled: true,
								format: '<b style="font-size:12px;font-weight:normal;color:#666">{point.name}</b><br><br><br><b style="font-size:12px;font-weight:normal;color:#666">占比：{point.percentage:.2f} %</b>',
								style: {color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'}
							}
						}
					},
					colors: ["#FF6F6F","#7CC7C0","#F7A35C","#95CEFF","#009688","#FEA2C8","#38C5FF","#FEA2C8","#7CC7C0","#ffab4a","#90C9FB","#ff6600","#0099cc","#ff9900","#0000ff","#0000cc"],
					series: [{
						name: '',
						colorByPoint: true,
						data:data
					}]
				});
			}
			setTimeout(function(){
				zeai.ajax({url:jsfilename+zeai.ajxext+'submitok=ajax_edu',data:{agentid:agentid}},function(e){
					if(!zeai.empty(e)){
						var rs=zeai.jsoneval(e);
						var yarr = rs.data;
						for(var k=0;k<yarr.length;k++) {
							yarr[k].y = parseFloat(yarr[k].y);
						}
						eduFn(yarr);
					}
				});
			},1100);
            </script>
            </td>
            <td width="50%">
            <div class="cbox">
                <h5>VIP会员学历分析<span class="line"></span></h5>
                <div id="edu_vip_box" style="height:280px"></div>
            </div>
            <script>
			function edu_vipFn(data){
				Highcharts.chart('edu_vip_box', {
					chart: {
						plotBackgroundColor: null,
						plotBorderWidth: null,
						plotShadow: false,
						type: 'pie'
					},
					title: {text: ''},
					tooltip: {pointFormat: '<font style="font-weight:normal;color:#666">{series.name}<br>{point.percentage:.2f}%</font>'},
					credits: {"enabled": false},
					plotOptions: {
						pie: {
							allowPointSelect: true,
							cursor: 'pointer',
							dataLabels: {
								enabled: true,
								format: '<b style="font-size:12px;font-weight:normal;color:#666">{point.name}</b><br><br><br><b style="font-size:12px;font-weight:normal;color:#666">占比：{point.percentage:.2f} %</b>',
								style: {color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'}
							}
						}
					},
					colors: ["#FF6F6F","#7CC7C0","#F7A35C","#95CEFF","#009688","#FEA2C8","#38C5FF","#FEA2C8","#7CC7C0","#ffab4a","#90C9FB","#ff6600","#0099cc","#ff9900","#0000ff","#0000cc"],
					series: [{
						name: '',
						colorByPoint: true,
						data:data
					}]
				});
			}
			setTimeout(function(){
				zeai.ajax({url:jsfilename+zeai.ajxext+'submitok=ajax_edu_vip',data:{agentid:agentid}},function(e){
					if(!zeai.empty(e)){
						var rs=zeai.jsoneval(e);
						var yarr = rs.data;
						for(var k=0;k<yarr.length;k++) {
							yarr[k].y = parseFloat(yarr[k].y);
						}
						edu_vipFn(yarr);
					}
				});
			},1600);
            </script>
            </td>
            </tr>
        </table>        

        <div class="cbox" style="width:98%">
            <h5>用户购房分析<span class="line"></span></h5>
            <div id="house_box" style="height:240px"></div>
        </div>
        <script>
        function houseFn(data){
            Highcharts.chart('house_box', {
                chart: {type: 'column'},
                title: {text: '　'},
                subtitle: {text: ''},
                credits: {"enabled": false},
                xAxis: {
                    type: 'category',
                    labels: {
                        rotation: 0,
                        style: {fontSize: '12px',fontFamily: 'Verdana, sans-serif'}
                    }
                },
                yAxis: {min: 0,title: {text:'住房占比人数'}},
                legend: {enabled: false},
                tooltip: {pointFormat: '<b style="font-weight:normal;color:#666">{point.y:.0f}人</b>'},
                colors: ["#95CEFF"],
                series: [{
                    name: 'zea.cn',
                    data: data,
                    dataLabels: {
                        enabled: true,
                        rotation:0,
                        align: 'center',
                        format: '{point.y:.0f}人', // one decimal
                        y:0, //10 pixels down from the top
                        style:{fontSize:'12px',fontWeight:'normal',fontFamily:'Arial,sans-serif'}
                    }
                }]
            });
        }
        setTimeout(function(){
            zeai.ajax({url:jsfilename+zeai.ajxext+'submitok=ajax_house',data:{agentid:agentid}},function(e){
                if(!zeai.empty(e)){
                    var arr=e;
                    arr = arr.replace(/"/g,"");
                    arr = zeai.jsoneval(arr);
                    houseFn(arr);
                }
            });
        },2600);
        </script>

        <table width="100%" border="0">
            <tr>
            <td width="50%">
            <div class="cbox">
                <h5>用户收入分析<span class="line"></span></h5>
                <div id="pay_box" style="height:300px"></div>
            </div>
            <script>
			function payFn(data){
				Highcharts.chart('pay_box', {
					chart: {
						plotBackgroundColor: null,
						plotBorderWidth: null,
						plotShadow: false,
						type: 'pie'
					},
					title: {text: ''},
					tooltip: {pointFormat: '<font style="font-weight:normal;color:#666">{series.name}<br>{point.percentage:.2f}%</font>'},
					credits: {"enabled": false},
					plotOptions: {
						pie: {
							allowPointSelect: true,
							cursor: 'pointer',
							dataLabels: {
								enabled: true,
								format: '<b style="font-size:12px;font-weight:normal;color:#666">{point.name}</b><br><br><br><b style="font-size:12px;font-weight:normal;color:#666">占比：{point.percentage:.2f} %</b>',
								style: {color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'}
							}
						}
					},
					colors: ["#FF6F6F","#7CC7C0","#F7A35C","#95CEFF","#009688","#FEA2C8","#38C5FF","#FEA2C8","#7CC7C0","#ffab4a","#90C9FB","#ff6600","#0099cc","#ff9900","#0000ff","#0000cc"],
					series: [{
						name: '',
						colorByPoint: true,
						data:data
					}]
				});
			}
			setTimeout(function(){
				zeai.ajax({url:jsfilename+zeai.ajxext+'submitok=ajax_pay',data:{agentid:agentid}},function(e){
					if(!zeai.empty(e)){
						var rs=zeai.jsoneval(e);
						var yarr = rs.data;
						for(var k=0;k<yarr.length;k++) {
							yarr[k].y = parseFloat(yarr[k].y);
						}
						payFn(yarr);
					}
				});
			},3100);
            </script>
            </td>
            <td width="50%">
            <div class="cbox">
                <h5>用户购车分析<span class="line"></span></h5>
                <div id="car_box" style="height:300px"></div>
            </div>
            <script>
			function carFn(data){
				Highcharts.chart('car_box', {
					chart: {
						plotBackgroundColor: null,
						plotBorderWidth: null,
						plotShadow: false,
						type: 'pie'
					},
					title: {text: ''},
					tooltip: {pointFormat: '<font style="font-weight:normal;color:#666">{series.name}<br>{point.percentage:.2f}%</font>'},
					credits: {"enabled": false},
					plotOptions: {
						pie: {
							allowPointSelect: true,
							cursor: 'pointer',
							dataLabels: {
								enabled: true,
								format: '<b style="font-size:12px;font-weight:normal;color:#666">{point.name}</b><br><br><br><b style="font-size:12px;font-weight:normal;color:#666">占比：{point.percentage:.2f} %</b>',
								style: {color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'}
							}
						}
					},
					colors: ["#FF6F6F","#7CC7C0","#F7A35C","#95CEFF","#009688","#FEA2C8","#38C5FF","#FEA2C8","#7CC7C0","#ffab4a","#90C9FB","#ff6600","#0099cc","#ff9900","#0000ff","#0000cc"],
					series: [{
						name: '',
						colorByPoint: true,
						data:data
					}]
				});
			}
			setTimeout(function(){
				zeai.ajax({url:jsfilename+zeai.ajxext+'submitok=ajax_car',data:{agentid:agentid}},function(e){
					if(!zeai.empty(e)){
						var rs=zeai.jsoneval(e);
						var yarr = rs.data;
						for(var k=0;k<yarr.length;k++) {yarr[k].y = parseFloat(yarr[k].y);}
						carFn(yarr);
					}
				});
			},3600);
            </script>
            </td>
            </tr>
        </table>        

        <!--t=2 end-->
      <?php }?>
        <!---->
	</div>
    <div class="clear"></div>
</div>
</script>
<?php require_once 'bottomadm.php';?>